<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0,viewport-fit=cover" />
        <meta name="screen-orientation" content="portrait" />
        <meta name="x5-orientation" content="portrait" />
        <meta http-equiv="Pragma" content="no-cache" />
        <meta http-equiv="Cache-Control" content="no-cache" />
        <meta http-equiv="Expires" content="0" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <link rel="stylesheet" href="/assets/css/index.css?v=1" />
        <title>Focus - 门窗世家 呵护到家</title>
    </head>
    <body data-design-width="750" style="max-width: 1000px;margin: 0 auto">
        <div class="adv">
            {volist name="top" id="vo"}
            <img src="{$vo.url}" alt="{$vo.title}" />
            {/volist}
            <div class="form-content">
                <div class="form-logo">
                    <img src="/assets/img/logo.jpg" alt="logo" />
                </div>
                <form action="">
                    <div class="form-item">
                        <label for="name">姓名<span>*</span></label>
                        <input type="text" name="name" value=""/>
                    </div>
                    <div class="form-item">
                        <label for="name">电话<span>*</span></label>
                        <input type="text" name="mobile" value=""/>
                    </div>
                    <div class="form-item">
                        <label for="name">城市名<span>*</span></label>
                        <input type="text" name="city" value="" placeholder="例如:成都"/>
                    </div>
                    <button type="button">我要预约</button>
                </form>
            </div>
            <!-- <img src="/assets/img/3.jpg" alt="图" /> -->
            {volist name="data" id="vo"}
            <img src="{$vo.url}" alt="{$vo.title}" />
            {/volist}

            <!-- <img src="/assets/img/15.jpg" alt="图" /> -->
            <!--<video src="http://www.w3school.com.cn/i/movie.ogg" autoplay="autoplay" controls="controls">您的浏览器不支持 video 标签。</video>-->
            <!--<img src="/assets/img/16.jpg" alt="图" />-->
        </div>
        <script src="/assets/js/MobileReponsive.js"></script>
        <script src="/assets/js/jquery-3.1.1.min.js"></script>
        <script src="https://cdn.bootcss.com/sweetalert/2.1.2/sweetalert.min.js"></script>
        <script type="text/javascript">
           $(function () {
               $('button').on('click',function () {
                   var params = {
                       name:$('input[name="name"]').val(),
                       mobile:$('input[name="mobile"]').val(),
                       city:$('input[name="city"]').val(),
                   };
                   if(params.name==''){
                       swal({
                           text: "请填写您的姓名!",
                       });
                       return false;
                   }
                   if(params.mobile==''){
                       swal({
                           text: "请填写您的电话!",
                       });
                       return false;
                   }
                   if(params.city==''){
                       swal({
                           text: "请填写您的居住城市!",
                       });
                       return false;
                   }
                   var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
                   //电话
                   if (!phoneReg.test(params.mobile)) {
                       swal({
                           text: "请输入有效的手机号码!",
                       });
                       return false;
                   }

                   $.post("{:url('index/yuyue')}",params,function (res) {
                       if(res.status){
                           swal({
                               icon: "success",
                               text: res.msg,
                           });
                       }else{
                           swal({
                               icon: "warning",
                               text: res.msg,
                           });
                       }
                       console.log(res);
                   })
               })
           })
        </script>
    </body>
</html>
